package com.lemon.boot.common.properties;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author 李猛
 * @datetime 2024/7/26 12:18
 * @description OSS
 */
@Setter
@Getter
@Component
@ConfigurationProperties(prefix = "aliyun.oss")
public class OssConfigProperties {
    //阿里云OSS端点
    private String endpoint;
    //阿里云OSS访问ID
    private String accessKeyId;
    //阿里云OSS访问密钥
    private String accessKeySecret;

    /**
     * 获取OSS
     *
     * @return
     */
    public OSS getOss() {
        return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
    }
}
